<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: summernote-css" />
	<th:block th:include="include :: easyui-header('通知公告列表')" />
</head>
<body class="white-bg">
    <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-head">
				<div class="easyui-panel">
					<form id="notice-form">
						<div class="select-list">
							<ul>
								<li>
									<label>公告标题：</label>
									<input type="text" name="noticeTitle" class="easyui-textbox" data-options="prompt:'请输入公告标题'"/>
								</li>
								<li>
									<label>操作人员：</label>
									<input type="text" name="createBy" class="easyui-textbox" data-options="prompt:'请输入操作人员'"/>
								</li>
								<li>
									<label>公告类型：</label>
									<select id="noticeType" name="noticeType" class="easyui-combobox" th:with="type=${@dict.getType('sys_notice_type')}">
										<option value=" ">所有</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
									</select>
								</li>
								<li>
									<a class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="$.easyUIDataGrid.search()" >查询</a>
									<a class="easyui-linkbutton" data-options="iconCls:'icon-clear'" onclick="$.easyUIDataGrid.reset()" >重置</a>
								</li>
							</ul>
						</div>
					</form>
				</div>
			</div>
			
	        <div class="col-sm-12 search-body">
	            <div id="toolbar" role="group">
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="$.easyUIOperate.add('1000','600')" shiro:hasPermission="system:notice:add">新增</a>
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-edit'" onclick="$.easyUIOperate.edit('1000','600')" shiro:hasPermission="system:notice:edit">修改</a>
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-delete'" onclick="$.easyUIOperate.removeAll()" shiro:hasPermission="system:notice:remove">删除</a>
		        </div>
			    <table id="dg" class="easyui-datagrid"></table>
	        </div>
    	</div>
    </div>
    <th:block th:include="include :: easyui-footer" />
    <th:block th:include="include :: summernote-js" />
 	<script th:inline="javascript">
 	 	var editFlag = [[${@permission.hasPermi('system:notice:edit')}]];
     	var removeFlag = [[${@permission.hasPermi('system:notice:remove')}]];
     	var types = [[${@dict.getType('sys_notice_type')}]];
     	var datas = [[${@dict.getType('sys_notice_status')}]];
    </script>
	<script th:inline="none">
        var prefix = ctx + "system/notice";
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "公告",
                idField:'noticeId',
                sortName: "createTime",
                sortOrder: "desc",
				columns:[[
					{
						field:'ck',
						checkbox:true,
						width:30
					},
			        {
			            field: 'noticeId',
			            title: '公告ID',
		            	align: 'center',
		            	hidden:true,
						width: 20
			        },
			        {
			        	field : 'noticeTitle', 
						title : '公告标题',
			            align: 'center',
		          		width: 160
			        },
			        {
				        field: 'noticeType',
			            title: '公告类型',
			            align: 'center',
			            width: 60,
			            formatter: function(value, row, index) {
			            	return $.table.selectDictLabel(types, value);
			            }
			        },
			        {
			        	field: 'status',
			            title: '状态',
			            align: 'center',
			            width: 60,
			            formatter: function(value, row, index) {
			            	return $.table.selectDictLabel(datas, value);
			            }
			        },
			        {
			        	field : 'createBy', 
						title : '创建者',
			            align: 'center',
		          		width: 60
			        },
			        {
		        	 	field: 'createTime',
			            title: '创建时间',
			            sortable: true,
			            align: 'center',
		          		width: 100
			        },
			        {
			        	field:'action',
			            title: '操作',
			            align: 'center',
		          		width: 80,
			            formatter: function(value, row, index) {
			            	var actions = [];
			            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.easyUIOperate.edit(\'1000\',\'600\',\'' + row.noticeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
	                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.easyUIOperate.remove(\'' + row.noticeId + '\')"><i class="fa fa-remove"></i>删除</a>');
							return actions.join('');
			            }
			        }
				]]
            };
            $.easyUIDataGrid.init(options);
        });
    </script>
</body>
</html>